import com.o2o.utils.Iargs
import org.apache.spark.sql.{DataFrame, SparkSession}

/**
  * @ Auther: o2o-rd-0008
  * @ Date:   2020/6/5 16:23
  * @ Param:  ${PARAM}
  * @ Description: 
  */
object CheckjumeiData {
  def main(args: Array[String]): Unit = {

    val spark = SparkSession.builder()
      .appName(s"${this.getClass.getSimpleName}")
      .config("spark.debug.maxToStringFields", "2000")
      .config("spark.serializer", "org.apache.spark.serializer.KryoSerializer")
      .config("spark.sql.caseSensitive", "true")
      .config("es.nodes", "192.168.1.29")
      .config("es.port", "9200")
      .config("cluster.name","O2OElastic")
      .config("es.net.http.auth.user", "elastic")
      .config("es.net.http.auth.pass", "changeme")
      .master("local[*]")
      .getOrCreate()

    val sc = spark.sparkContext
    sc.hadoopConfiguration.set("fs.s3a.access.key", Iargs.OBSACCESS)
    sc.hadoopConfiguration.set("fs.s3a.secret.key", Iargs.OBSSECRET)
    sc.hadoopConfiguration.set("fs.s3a.endpoint", Iargs.OBSENDPOINT)
    sc.setLogLevel("WARN")
//    var resultPath = s"s3a://o2o-dataproces-group/zsc/2020/618/miya/good"
//    val path =s"s3a://o2o-sourcedata/obs-source-2020/618/gov/meituan_tg/"
    val path ="s3a://o2o-dataproces-group/zsc/2020/618/miya/good_new"
//    val path ="s3a://dws-data/g_shop/618/20200618_2020_0617_yoy/tmall/"
//    val path =s"s3a://o2o-sourcedata/obs-source-2020/618/gov/dazhongdp/"
//val sourceData_url =  s"s3a://o2o-sourcedata/obs-source-2020/618/gov/jumei"
    val path1 ="s3a://dws-data/g_data/jd_cloud/xianyou/jd/2020_7/"
    var year ="2020"
    var month = "7"
    var platform = "dingdongmc"
    var index247 = s"2020_dingdongmc_${month}/type_1"

    //good路径
    val goodPath= "s3a://o2o-dataproces-group/zsc/2020/8/jumei/"
//    val catepath = s"s3a://o2o-dimension-table/category_table/jd/jd_sub_v26/*"
    //入库
    import org.apache.spark.sql.functions._
    val frame: DataFrame = spark.read.orc(goodPath).drop("timeStamp").withColumn("timeStamp",lit("1598716800"))

    frame.write.orc("s3a://o2o-dataproces-group/zsc/2020/8/jumei_new/")

  sc.stop()
}
}
